Write
==========
This page contains the documentation for 'write.py'. This module provides functions to generate and write injection files for gravitational wave simulations, including random and deterministic glitches and gravitational waves. The injection files are in the form of a .json file.
Function Definitions
----------------------
.. raw:: html
GlitchPop.write.random_glitch(ifo, run, mu=0.1, duration=100, gps=0, interval=None, probs=[0.25, 0.25, 0.25, 0.25], seed=0, scale=1, file=False, basename="", gw_inject=True)
Randomly generates time series with glitches and writes to an injection file.
**Parameters:**
- **ifo** (string) - Interferometer abbreviation
- **run** (string) - Observing run
- **mu** (float) - Poisson rate parameter; average number of glitches per second
- **duration** (float) - Duration of time series
- **gps** (float) - Starting GPS time of time series
- **interval** (NoneType or float) - Optional interval of repeating glitches
- **probs** (list) - List of probabilities of each type of glitch occurring; probabilities are blip, lfb, tomte, koi and sum to one
- **seed** (int) - Random seed used to generate noise
- **scale** (float) - Scale of Gaussian noise
- **file** (bool) - Argument to enable the return of the injection file name
- **basename** (string) - String to insert at the start of the file name, optional
- **gw_inject** (bool) - Option to generate .json file with empty GW parameter columns
**Returns:**
- **gwpy.timeseries.TimeSeries** - Time series with Gaussian noise and glitches
- **string** - The injection file's name (if `file=True`)
.. raw:: html
GlitchPop.write.determ_glitch(ifo, run, glitches, times, seeds, duration=100, gps=0, scale=1, basename="", suggest=True, file=False, gw_inject=True)
Deterministically generates time series with specified glitches and writes to an injection file.
**Parameters:**
- **ifo** (string) - Interferometer abbreviation
- **run** (string) - Observing run
- **glitches** (list) - List containing strings of glitch types
- **seeds** (list) - List containing integers of random seeds
- **duration** (float) - Duration of time series
- **gps** (float) - Starting GPS time of time series
- **scale** (float) - Scale of Gaussian noise
- **basename** (string) - String to insert at the start of the file name, optional
- **suggest** (bool) - Option to use suggested bounds on parameter distributions
- **file** (bool) - Option to return the file name of the generated .json file
- **gw_inject** (bool) - Option to generate .json file with empty GW parameter columns
**Returns:**
- **gwpy.timeseries.TimeSeries** - Time series with Gaussian noise and glitches
- **string** - The injection file's name (if `file=True`)
.. raw:: html
GlitchPop.write.determ_gw(ifo, ts, filename, t_merge, signals, seeds, precession=False, *kwargs)
Deterministically simulates a single detector's calibrated strain channel and writes an injection file with gravitational wave signals.
**Parameters:**
- **ifo** (string) - Interferometer abbreviation
- **ts** (gwpy.timeseries.TimeSeries) - Time series with noise and glitches
- **filename** (string) - Name of the injection file that describes `ts`; must have columns with GW parameters
- **t_merge** (list) - List of merger times
- **signals** (list) - List of strings of CBC types, in order with merger times
- **seeds** (list) - List of random seed integers, in order with merger times
- **precession** (bool) - Optional argument to enable x & y spins
**Returns:**
- **gwpy.timeseries.TimeSeries** - Time series with injected CBC signals
.. raw:: html
GlitchPop.write.random_gw(ifo, run, gps=0, duration=500, mu_glitch=0.1, mu_gw=10e-5, interval=None, probs_glitch=[0.25, 0.25, 0.25, 0.25], probs_gw=[1/3, 1/3, 1/3], precession=False, *kwargs)
Randomly simulates a single detector's calibrated strain channel with glitches and gravitational waves, and writes an injection file
**Parameters:**
- **ifo** (string) - Interferometer abbreviation
- **run** (string) - Observing run
- **gps** (float) - Starting GPS time of time series
- **duration** (float) - Duration of time series
- **mu_glitch** (float) - Poisson rate parameter; average number of glitches per second
- **mu_gw** (float) - Poisson rate parameter; average number of GWs per second
- **interval** (NoneType or float) - Optional, repeating interval of glitches
- **probs_glitch** (list) - List of floats containing probabilities of generating each glitch; Probabilities are blip, LFB, tomte, koi and sum to 1
- **probs_gw** (list) - List of floats containing probabilities of generating each type of CBC signal; Probabilities are BHBH, NSBH, BNS and sum to 1
- **precession** (bool) - Optional argument to enable x & y spins
**Returns:**
- **gwpy.timeseries.TimeSeries** - Time series with Gaussian noise, glitches, and GWs
.. raw:: html
GlitchPop.write.determ_tri_ifo(h1, h1_file, l1, l1_file, v1, v1_file, t_merge, signals=['BHBH'], seeds=[0], precession=False, *kwargs)
Deterministically simulates the 3-detector network and writes injection files with gravitational waves
**Parameters:**
- **h1** (gwpy.timeseries.TimeSeries) - H1 strain without GW signals
- **h1_file** (string) - Name of the injection file that describes `h1`
- **l1** (gwpy.timeseries.TimeSeries) - L1 strain without GW signals
- **l1_file** (string) - Name of the injection file that describes `l1`
- **v1** (gwpy.timeseries.TimeSeries) - V1 strain without GW signals
- **v1_file** (string) - Name of the injection file that describes `v1`
- **t_merge** (list) - List of CBC merger times
- **signals** (list) - List of strings of CBC types, in order with merger times
- **seeds** (list) - List of random seed integers, in order with merger times
- **precession** (bool) - Optional argument to enable x & y spins
**Returns:**
- **gwpy.timeseries.TimeSeries** - H1 strain with injected GWs
- **gwpy.timeseries.TimeSeries** - L1 strain with injected GWs
- **gwpy.timeseries.TimeSeries** - V1 strain with injected GWs
.. raw:: html
GlitchPop.write.random_tri_ifo(run, gps=0, duration=500, mu_glitch=0.1, mu_gw=10e-5, interval=None, probs_glitch=[0.25, 0.25, 0.25, 0.25], probs_gw=[1/3, 1/3, 1/3], precession=False, *kwargs)
Randomly simulates the 3-detector network with glitches and gravitational waves, and writes injection files
**Parameters:**
- **run** (string) - Observing run
- **gps** (float) - Starting GPS time of time series
- **duration** (float) - Duration of time series
- **mu_glitch** (float) - Poisson rate parameter; average number of glitches per second
- **mu_gw** (float) - Poisson rate parameter; average number of GWs per second
- **interval** (NoneType or float) - Optional, repeating interval of glitches
- **probs_glitch** (list) - List of floats containing probabilities of generating each glitch; Probabilities are blip, LFB, tomte, koi and sum to 1
- **probs_gw** (list) - List of floats containing probabilities of generating each type of CBC signal; Probabilities are BHBH, NSBH, BNS and sum to 1
- **precession** (bool) - Optional argument to enable x & y spins
**Returns:**
- **gwpy.timeseries.TimeSeries** - H1 strain with Gaussian noise, glitches, and GWs
- **gwpy.timeseries.TimeSeries** - L1 strain with Gaussian noise, glitches, and GWs
- **gwpy.timeseries.TimeSeries** - V1 strain with Gaussian noise, glitches, and GWs